﻿
namespace Patterns4Net.Tests.PatternEnforcer.Core.Patterns.Regression
{
    using System;
    using NUnit.Framework;
    using Patterns4Net.Core.CecilExtensions;
    using Patterns4Net.Core.Patterns;
    using Patterns4Net.PatternEnforcer.Core.Patterns;

    [TestFixture]
    public class PrototypeCheckerTest : PatternCheckerTestBase
    {
        [Test]
        [TestCase(typeof(NonCloneable))]
        [TestCase(typeof(Cloneable))]
        public void RunAllTests(Type type)
        {
            this.TestChecker(
                new PrototypeChecker(), 
                type,
                new Prototype(type.GetTypeDefinition()));
        }

        [PatternTest(false)]
        public class NonCloneable
        {            
        }

        [PatternTest(true)]
        public class Cloneable : ICloneable
        {
            public object Clone()
            {
                throw new NotImplementedException();
            }
        }
    }
}
